package com.example.mapper.shopping;


import com.example.model.entity.medical.Doctor;
import com.example.model.entity.shopping.Medicines;
import com.example.model.vo.MedicinesVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 操作medicines相关数据接口
*/
public interface MedicinesMapper {

    /**
      * 新增
    */
    int insert(Medicines medicines);

    /**
      * 删除
    */
    int deleteById(Integer id);

    /**
      * 修改
    */
    int updateById(Medicines medicines);

    /**
      * 根据ID查询
    */
    Medicines selectById(Integer id);

    /**
      * 查询所有
    */
    List<MedicinesVO> selectAll(Medicines medicines);

    @Select("select * from medicines where businessId = #{businessId}")
    List<Medicines> selectByBusinessId(Integer id);

    @Select("SELECT SUM(count) FROM medicines WHERE businessId = #{buinessId}")
    int selectTotalSalesByBusinessId(int businessId);

    MedicinesVO selectDetailById(Integer medicinesId);

    List<MedicinesVO> selectByTypeId(Integer typeId);

    List<MedicinesVO> selectDetailByBusinessId(Integer businessId);
    @Select("select id from medicines where name = #{name}")
    Integer selectMedicinesByName(String name);


}
